﻿<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<link href="/LiberUI/Style/LiberUI.css" rel="stylesheet" />
<link href="/SiteUI/Base.css" rel="stylesheet" />
<link href="/SiteUI/Register/Register.css" rel="stylesheet" />
<html>
<body>
    <div class="view" id="headBar">
        <div class="row">
            <div class="col-lg-5 col-lg-offset-1" id="siteLogo">

            </div>
            <div class="col-lg-6" id="siteLink">
                <a href="/Index.html">首页</a>
                <a href="/Products.html">采购云协同</a>
                <a href="/BizCase.html">案例</a>
                <a href="/AboutUS.html">关于我们</a>
            </div>
        </div>
    </div>

    <div class="view_fix" id="viewRegister">
        <div class="row step2" id="vr-steps2"></div>
        <div class="row" id="vr-tip">
            您在本平台的行为将代表企业的利益，为保证数据安全，我们需要核实您的真实身份信息
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4" id="gbsj">
                <strong>手机号码：</strong>
                <span id="lblPhone"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/Register.html" class="LinkTo">更改手机号</a>
                <div>&nbsp;</div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4">
                <h5>真实姓名：</h5>
                <input maxlength="10" id="txbName" placeholder="请输入您的真实姓名" />
            </div>
            <div class="col-lg-4">
                <h5>&nbsp;</h5>
                <div id="it-name" class="inputTip"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4">
                <h5>业务邮箱：</h5>
                <input maxlength="50" id="txbMail" placeholder="请输入您常用电子邮箱" />
            </div>
            <div class="col-lg-4">
                <h5>&nbsp;</h5>
                <div id="it-mail" class="inputTip"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4">
                <h5>身份证号：</h5>
                <input maxlength="18" id="txbIdentity" placeholder="公民身份证号码" />
            </div>
            <div class="col-lg-4">
                <h5>&nbsp;</h5>
                <div id="it-identity" class="inputTip"></div>
            </div>
            
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4">
                <h5>认证资料：</h5>
            </div>          
            <div class="col-lg-2 col-lg-offset-4 picUpload" id="picIDCard-face">
                <img src="SiteUI/Imgs/idcard-example-face.jpg" />
            </div>
            <div class="col-lg-5" id="face_reminder">
                    <strong>点击左侧图片替换您自己的照片</strong><a class="LinkTo" target="_blank" href="SiteUI/Imgs/idcard-example-face-big.jpg">点这里查看样例</a>
                    <br />
                    免冠(建议未化妆)，手持本人证件；
                    <br />
                    所有信息清晰可见，必须能看得清证件号,不得做任何修改。；
                    <br />
                    照片支持.jpg .jpeg .bmp .gif .png格式照片，大小不超过8M。
            </div>
            <div class="col-lg-4 col-lg-offset-4">  
                <div id="it-idcard" style="margin:0" class="inputTip"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-4 col-lg-offset-4 button btn-big" id="btnApply">
                提交认证申请
            </div>
        </div>
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2" >        
                <div id="face_subbtn">
                    1、保密承诺：您的身份信息仅用于天联云企业用户实名认证使用，天联云不会将个人身份信息用作其他商业用途；<br />
                    2、审核时限：个人实名认证时限为5个工作日内。
                </div>
            </div>
        </div>
        
    </div>
    <div class="view" id="pageFoot">

    </div>
    <script src="/LiberUI/Scripts/jquery.js"></script>
    <script src="/LiberUI/Scripts/LiberUI.Base.js"></script>
    <script src="/LiberUI/Scripts/LiberUI.js"></script>
    <script src="/LiberUI/Scripts/LiberUI.Action.js"></script>
    <script src="/SiteUI/res_sobiz.js"></script>

    <script>
        var AcntCertify = {
            certify:{
                phone:null,
                name:null,
                mail:null,
                socialid:null,
                idcardface:null
            },
            picFace:null,
            mailFormat: /^([0-9A-Za-z\-_\.]+)@([0-9A-Za-z]+\.[A-Za-z0-9]{2,3}(\.[A-Za-z0-9]{2,3})?(\.[A-Za-z0-9]{2,3})?(\.[A-Za-z]{2,3})?)$/,//邮箱校验正则
            identityFormat: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,//身份证校验正则
            onPicFaceChange: function (ev) {
                $("#it-idcard").vl("").removeClass("error");
                switch (ev.Status) {
                    case "imageLoaded":
                        $("#picIDCard-face>img").attr("src", ev.Item.thumbnail);
                        break;
                    case "uploadProcessing":
                        $("#it-idcard").removeClass("error,success").vl("正在上传...");
                        break;
                    case "uploadEnd":
                        $("#it-idcard").removeClass("error").addClass("success").vl("上传成功");
                        AcntCertify.certify.idcardface = ev.Item.Result.path;
                        break;
                }
            },
            applyCertify: function () {
                if (AcntCertify.checkMail()& AcntCertify.checkIdentity()&AcntCertify.checkName()&AcntCertify.checkIdPic()) {
                    $.post("/MyBiz/ApplyCertify", AcntCertify.certify, AcntCertify.applyCertifyEnd);
                }
            },
            applyCertifyEnd: function (rtn) {
                if (rtn.IsPositive) {
                    success("成功", "您的实名认证申请已提交").on("disposed", function (ev) { window.location = "/SetCompany.html"; });
                }
                else {
                    error("失败", ErrFormate(res_Sobiz, rtn.ErrorSrc, rtn.ErrorCode, rtn.Error));
                }
            },
            checkMail: function () {
                var mail = $("#txbMail").vl();
                if (!AcntCertify.mailFormat.test(mail)) {
                    $("#it-mail").vl("邮箱格式不正确").addClass("error");
                    return false;
                } else {
                    $("#it-mail").removeClass("error").vl("");
                    AcntCertify.certify.mail = $("#txbMail").vl();
                    return true;
                }
            },
            checkIdentity: function () {
                var sid = $("#txbIdentity").vl();
                if (!AcntCertify.identityFormat.test(sid)) {
                    $("#it-identity").vl("身份证格式不正确").addClass("error");
                    return false;
                } else {
                    $("#it-identity").removeClass("error").vl("");
                    AcntCertify.certify.socialid = sid;
                    return true;
                }
            },
            checkName: function () {
                var n = $("#txbName").vl();
                if (n.length <= 0) {
                    $("#it-name").vl("请输入您的真实姓名").addClass("error");
                    return false;
                }
                else {
                    $("#it-name").vl("").removeClass("error");
                    AcntCertify.certify.name = n;
                    return true;
                }
            },
            checkIdPic: function () {
                if (AcntCertify.certify.idcardface == null) {
                    $("#it-idcard").vl("请上传正确的图片").addClass("error");
                    return false;
                }
                else {
                    $("#it-idcard").vl("").removeClass("error");
                    return true;
                }
            }
        }

        $(function () {
            AcntCertify.certify.phone = $.Cookie("newphone");
            if (!AcntCertify.certify.phone) {
                //TODO:没有手机号码，弹出提示，并返回前一个注册页面
                window.location = "/Register.html";
            }
            //TODO:对手机号中间4位替换为*
            var phone = AcntCertify.certify.phone;
            $("#lblPhone").vl(phone.substring(0, 3) + "****" + phone.substring(8, 11));

            $("#txbName").blur(AcntCertify.checkName);
            $("#txbMail").blur(AcntCertify.checkMail);
            $("#txbIdentity").blur(AcntCertify.checkIdentity);

            $("#btnApply").on("click", AcntCertify.applyCertify);

            AcntCertify.picFace = new LiberUI.Uploader("#picIDCard-face")
                                             .option("FileType", "image/*")
                                             .option("MaxSize", 8*1024*1024)
                                             .update();
            AcntCertify.picFace.on("change", AcntCertify.onPicFaceChange);

            $("#pageFoot").load("/common/pageFoot.html");

            $("#txbName").focus();
        })
    </script>

    <div id="tplPrompt" style="display:none">
        <div class="prompt_success">
            <div class="p_body">
                <h4>title</h4>
                <span>message</span>
            </div>
        </div>
        <div class="prompt_info">
            <div class="p_body">
                <h4>title</h4>
                <span>message</span>
            </div>
        </div>
        <div class="prompt_err">
            <div class="p_body">
                <h4>title</h4>
                <span>message</span>
            </div>
        </div>
    </div>

    <script>
    window.success = function (title,msg, delay, fnCallback) {
        var cnt = $("#tplPrompt>.prompt_success").clone();
        cnt.children(".p_body").children("h4").vl(title);
        cnt.children(".p_body").children("span").vl(msg);
        var p = new LiberUI.Prompt(cnt);
        p.option("Delay", delay);
        p.update();
        if (ObjHelper.IsFunc(fnCallback)) {
            p.on("disposed", fnCallback);
        }
        return p.show();

    };
    window.info = function (title,msg, delay,fnCallback) {
        var cnt = $("#tplPrompt>.prompt_info").clone();
        cnt.children(".p_body").children("h4").vl(title);
        cnt.children(".p_body").children("span").vl(msg);
        var p = new LiberUI.Prompt(cnt);
        p.option("Delay", delay);
        p.update();
        if (ObjHelper.IsFunc(fnCallback)) {
            p.on("disposed", fnCallback);
        }
        return p.show();
    };
    window.error = function (title, msg, delay, fnCallback) {
        var cnt = $("#tplPrompt>.prompt_err").clone();
        cnt.children(".p_body").children("h4").vl(title);
        cnt.children(".p_body").children("span").vl(msg);
        var p = new LiberUI.Prompt(cnt);
        p.option("Delay", delay);
        p.update();
        if (ObjHelper.IsFunc(fnCallback)) {
            p.on("disposed", fnCallback);
        }
        return p.show();
    };

    window.log = function (msg) {
        if (console) {
            console.log(msg);
        }
    };

    </script>
</body>
</html>



